package com.ea.eadp.nexus.test.pageDefinition.pc;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;

import com.ea.eadp.nexus.test.pageDefinition.BasePage;

public class UpdateParentEmailPage extends BasePage {
    
    public UpdateParentEmailPage(WebDriver driver) {
        super(driver, RequireParentEmailPage.class);
    }
    
    public WebElement txt_parentEmail;
    public WebElement btn_next;
    public WebElement btn_cancel;
    
    public static class ControlDefinitions {
        public static By txt_parentEmail = By.id("parentEmail");
        public static By btn_next = By.xpath("//div[@id='right-column-action-area']/a");
        public static By btn_cancel = By.xpath("//div[@id='right-column-action-area']/a[2]");
        public static By txt_status = By.xpath("//li[@id='email-container']/div/span[3]");
    }
    
    public void initControls() {
        this.txt_parentEmail = driver.findElement(ControlDefinitions.txt_parentEmail);
        this.btn_next = driver.findElement(ControlDefinitions.btn_next);
        this.btn_cancel = driver.findElement(ControlDefinitions.btn_cancel);
    }
    
    public void initPage() {
        waitForWebElementPresent(ControlDefinitions.btn_next);
        initControls();
    }

    public String getStatusMessage(){
        return driver.findElement(ControlDefinitions.txt_status).getText().trim();
    }

}
